package main

import (
	"server/apps"
	"server/core"
	"server/global"
)

func main() {
	core.InitServer()

	if global.SysDB != nil {
		apps.MigrateTables()
		db, _ := global.SysDB.DB()
		defer db.Close()
	}

	if global.OdsDB != nil {
		defer global.OdsDB.Close()
	}

	if global.UdsDB != nil {
		defer global.UdsDB.Close()
	}

	if global.Etcd != nil {
		defer global.Etcd.Close()
	}

	if global.XidwRedis != nil {
		defer global.XidwRedis.Close()
	}

	core.RunWindowsServer()
}
